import React, { Component } from 'react'

class Yagada extends Component {
    state ={
        haha:null
    }
    render() {
    return (
      <div>{this.state.haha}</div>
    )
  }
  componentWillReceiveProps(nextprops){
    this.setState({
        haha:nextprops.title
    })
    }
}


export default class App extends Component {
    state = {
        title:111
    }
    render() {
    return (
      <div>
          <button onClick={()=>{
              this.setState({
                  title:222
              })
          }}>click</button>
          <Yagada title={this.state.title}></Yagada>
      </div>
    )
  }
}
